package com.lu.mapper;

import com.lu.entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StudentMapper {

    //查询学生全部数据
    @Select("select id,student_number studentNumber,student_name studentName,gender,age," +
            "class_name className,phone_number phoneNumber from student")
    List<Student> findAll();

    //根据id删除学生数据
    @Delete("delete from student where id = #{id}")
    public void deleteById(int id);

    //根据id查询学生数据
    @Select("select id,student_number studentNumber,student_name studentName,gender,age," +
            "class_name className,phone_number phoneNumber from student where id = #{id}")
    List<Student> findById(int id);

    //修改学生数据
    void updateData(Student student);

    //添加学生数据
    void insertData(Student student);

    //根据传入的学号和姓名查询对应的数据
    List<Student> findByStdName(Student student);
}
